<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加会员信息</title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/static/plupload/upfiless.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Theme1/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>添加会员信息 <a href="__URL__/lists" style="margin-left:15px; color:#06cbc4">会员列表</a></h5>
                        <div class="ibox-tools">
                            
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="post" action="__URL__/AddAction" class="form-horizontal" id="form-admin-add" enctype="multipart/form-data">
                          
                            <div class="form-group">
                                <label class="col-sm-1 control-label">手机号码</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_tel" id="txt_tel" class="form-control" onBlur="shoujihaoma(this.value)" />
                                </div>

                            </div>
						  

                            <div class="form-group">
                                 <label class="col-sm-1 control-label">姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_bankname" id="txt_bankname" class="form-control">
                                </div>

                            </div>
							

                            <div class="form-group">
                                <label class="col-sm-1 control-label">推荐码</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_rid" id="txt_rid" class="form-control" onBlur="is_tuijian(this.value)">
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">密码</label>
                                <div class="col-sm-3">
                                    <input type="text" name="txt_pwd1" id="txt_pwd1" class="form-control">
                                </div>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">微信二维码</label>
                                <div class="col-sm-3">
                                    <input type="file" id="weixin" name="weixin" class="weixin" placeholder="s" value="">
                                </div>

                            </div>
                          
						  
							
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">添加会员</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/iCheck/icheck.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/jquery.validate.min.js"></script> 

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/messages_zh.min.js"></script> 

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/validate-methods.js"></script> 
<script type="text/javascript" src="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.min.js"></script> 

    <script>
        $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    </script>
    
    <script type="text/javascript">
	
	function shoujihaoma(thisvalue){
	
			var reg = /^\d{9,}$/;

			$("#txt_tel-error").remove();
		 if(!reg.test(thisvalue)){
			$("#txt_tel").addClass("error");
			$("#txt_tel").after('<label id="txt_tel-error" class="error" for="txt_tel" style="display: inline-block;">格式不正确</label>');
			
			return false;
		 }
		 else{
			$("#txt_tel").removeClass("error");
			return true;
		 }
		 
	 
	}
	
	function is_tuijian(thisvalue)
	{
		if(thisvalue.length>0){
			$("#is_tuijian-error").remove();
		htmlobj=$.ajax({url:"__URL__/CheckTuijian?username=" + escape(thisvalue),async:false});
		if (escape(htmlobj.responseText)=="0"){
			
			$("#txt_rid").addClass("error");
			$("#txt_rid").after('<label id="is_tuijian-error" class="error" for="txt_rid" style="display: inline-block;">推荐人不存在</label>');
			
			return false;
		}
		if (escape(htmlobj.responseText)=="1"){
			$("#txt_rid").removeClass("error");
			return true;
		}
	 }
		
	}
	
	
	$(function(){
	
	$("#form-admin-add").validate({
		rules:{
            txt_loginname1:{
                required:true,
                minlength:1,
                maxlength:8
            },
            txt_bankname:{
                required:true,
                minlength:1,
                maxlength:16
            },
			
            txt_rid:{
                required:true,
                minlength:1,
                maxlength:16
            },
            txt_tel:{
                required:true,
                minlength:7,
                maxlength:11
            },
            txt_pwd1:{
                required:true,
                minlength:6,
                maxlength:20
            },
            txt_pwd2:{
                required:true,
                minlength:6,
                maxlength:20
            }
        },
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
		
			if(is_tuijian($("#txt_rid").val()) && shoujihaoma($("#txt_tel").val()))
			{
			
				$(form).ajaxSubmit();
				var index = parent.layer.getFrameIndex(window.name);
				parent.$('.btn-refresh').click();
				parent.layer.close(index);
			}
			
			
		}
	});
});
</script> 

</body>

</html>
